#include<bits/stdc++.h>
using namespace std;
const int maxn=20000005,mod=998244353;
int n,m,ps,fac,now,inc,Dec;
bool c[maxn];
int p[maxn/10],mul[maxn],sum[maxn];
int ksm(int a,int b){
	int res=1;
	while(b){
		if(b&1)
			res=1ll*res*a%mod;
		a=1ll*a*a%mod,b>>=1;
	}
	return res;
}
int main(){
	freopen("drama.in","r",stdin);
	freopen("drama.out","w",stdout);
	scanf("%d%d",&m,&n);
	if(m>n)
		m=n;
	fac=1;
	for(int i=1;i<=m;i++)
		fac=1ll*fac*i%mod;
	fac=ksm(fac,mod-2);
	mul[1]=c[1]=1;
	for(int i=2;i<=m;i++){
		if(c[i]==0)
			p[++ps]=i,mul[i]=ksm(i,n);
		for(int j=1;j<=ps&&i*p[j]<=m;j++){
			c[i*p[j]]=1,mul[i*p[j]]=1ll*mul[i]*mul[p[j]]%mod;
			if(i%p[j]==0)
				break;
		}
	}
	now=fac;
	for(int i=m;i>=1;i--)
		sum[i]=1ll*mul[i]*now%mod,now=1ll*now*i%mod;
	for(int i=1;i<=m;i++){
		sum[i]+=sum[i-1];
		if(sum[i]>=mod)
			sum[i]-=mod;
	}
	now=fac;
	for(int i=m;i>=0;i--){
		if(i&1)
			Dec=(Dec+1ll*now*sum[m-i])%mod;
		else inc=(inc+1ll*now*sum[m-i])%mod;
		now=1ll*now*i%mod;
	}
	printf("%d\n",(inc-Dec+mod)%mod);
	return 0;
}

